<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>

  <script>
      let car=["理想","蔚来","特斯拉"]
      let car1=["问界","byd","哪吒"]
      // es5 将俩个数组连接 赋值给新数组
      let carlist=car.concat(car1)
      // es5 将car1的内容放置到car数组中去
      car1.forEach(item=>{
        car.push(item)
      })
      
      // es6的扩展运算符 ...
      // 作用: 合并数组 ,合并对象
      // es6的将俩个数组连接 赋值给新数组
      let newcartlist=[...car1,...car]
      let car2=["五菱宏光","欧拉"]
      let mylist=[...car1,...car2,...car];
      console.log(mylist)

      // 2) 对象的扩展
      let obj={
        name:"小王",
        age:18
      }
      let obj2={
        sex:"男",
        hobby:"女"
      }
      // es5的合并对象
      // for(key in obj2){
      //   obj[key]=obj2[key];
      // }
      // console.log(obj)
      obj={
        ...obj,
        ...obj2
      }
      console.log(obj)
      // es6的 扩展运算符
      let arr2=[["a","b","c"]]
      let arr3=["d","e","f"]
      arr2=[...arr2,arr3 ]
      // ...arr 在函数的形参上 来替代 arguments
      function say(...arr) {
        console.log(arr)//[1,2,3,4,5,6]
      }
      say(1,2,3,4,5,6);
      
      function run() { 
        console.log(arguments)//arguments 参数的集合
     }
     run(1,2,3,4,5)
    //  如在上拉加载更多 list已加载的数据...res.data.list后台新的数据
    //  let list=[...list,...res.data.list];

    



  </script>
</body>
</html>